<?php

use yii\db\Migration;

class m240417_014729_diandi_hotel_comment extends Migration
{
    public function up()
    {
        /* 取消外键约束 */
        $this->execute('SET foreign_key_checks = 0');
        
        /* 创建表 */
        $this->createTable('{{%diandi_hotel_comment}}', [
            'id' => "int(11) unsigned NOT NULL AUTO_INCREMENT COMMENT 'id'",
            'bloc_id' => "int(11) NULL COMMENT '公司ID'",
            'store_id' => "int(11) NULL COMMENT '商户ID'",
            'hotel_id' => "int(11) NULL COMMENT '酒店ID'",
            'create_time' => "datetime NULL COMMENT '创建时间'",
            'update_time' => "datetime NULL COMMENT '更新时间'",
            'member_id' => "int(11) NULL COMMENT '会员id'",
            'order_id' => "int(11) NULL COMMENT '订单id'",
            'room_id' => "int(11) NULL COMMENT '房间ID'",
            'labels' => "varchar(100) NULL COMMENT '评价标签'",
            'comment' => "varchar(255) NULL COMMENT '评论内容'",
            'star_num' => "int(11) NULL COMMENT '综合星级'",
            'thumbs' => "varchar(255) NULL COMMENT '评价图片'",
            'PRIMARY KEY (`id`)'
        ], "ENGINE=InnoDB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='评论表'");
        
        /* 索引设置 */
        
        
        /* 表数据 */
        
        /* 设置外键约束 */
        $this->execute('SET foreign_key_checks = 1;');
    }

    public function down()
    {
        $this->execute('SET foreign_key_checks = 0');
        /* 删除表 */
        $this->dropTable('{{%diandi_hotel_comment}}');
        $this->execute('SET foreign_key_checks = 1;');
    }
}

